<template>
  <div>
    <div class="proApp-box">
      <el-form size="medium" label-width="220px" v-for="(item,index) in both_form" :key="index">
        <div
          v-for="(both_item, both_index) in mconfig.both_config[class_id]"
          :key="both_index+'both_index'"
        >
          <el-form-item :label="both_item.title + '：'" v-if="both_item.field=='ptype'">
            <span>{{item[both_item.field]}}</span>
          </el-form-item>
          <el-form-item :label="both_item.title + '：'" v-else-if="item[both_item.field]!=''">
            <imgshow v-if="(both_item.field=='busimg') || (both_item.field=='idcardimg')">
              <img :src="mconfig.host + item[both_item.field]" alt />
            </imgshow>
            <span v-else>{{item[both_item.field]}}</span>
          </el-form-item>
        </div>
      </el-form>
    </div>
  </div>
</template>

<script>
import imgshow from "./imgshow";
export default {
  components: {
    imgshow,
  },
  props: {
    callback: {
      //回显数据,后端响应的完整数据
      type: Array,
      default() {
        return [];
      },
    },
  },
  watch: {
    callback(value) {
      if (value.length > 0) {
        this.fun();
      }
    },
  },
  methods: {
    fun() {
      let one = {};
      this.both_form = this.callback;
      console.log(this.callback, 123456);
      this.class_id = this.callback[0].classId;
      this.mconfig.both_config[this.class_id].map((item) => {
        one[item.field] = item.default ? item.default : "";
      });
      for (let i = 0; i < this.both_form.length; i++) {
        if (this.both_form[i]["ptype"] == 1) {
          this.both_form[i]["ptype"] = "自然人";
        } else {
          this.both_form[i]["ptype"] = "企业/单位申请";
        }
      }
    },
  },
  data() {
    return {
      both_form: [],
      arr: [],
      class_id: 1,
      onde_data: {},
      show_pro: false,
    };
  },

  mounted() {
    if (this.callback.length > 0) {
      this.fun();
    }
  },
};
</script>
<style scoped>
.proApp-box {
  width: 800px;
  /* margin: 0 auto; */
}
</style>
